﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////


#include "GnufDisplayAndPickFilterInitializer.h"
#include "GbmpCommandNames.h"
#include "GcmpBuiltInCategoryUniIdentities.h"
#include "IGnufProductCommonEditUIFactory.h"
#include "IDocument.h"
#include "IModelLine.h"
#include "GnufCommonEditUIFactory.h"
#include "ComponentEditorGnufUICommandIds.h"

#include "EnableCompileWarning_The_LAST_IncludeInCpp.h"

using namespace gcmp;
using namespace gfam;

gcmp::OwnerPtr<DisplayAndPickFilterInitializerBase> gfam::CommonEditUIFactory::CreateDisplayAndPickFilterInitializer() const
{
    return NEW_AS_OWNER_PTR(DisplayAndPickFilterInitializer);
}

bool gfam::CommonEditUIFactory::CanExtend(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanJoin(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanTrim(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanBreak(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanRadial(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanRotate(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanCopy(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanMove(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanAlignment(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanOffset(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanLinearPattern(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanMirror(const gcmp::UniIdentity & uid) const
{
    return true;
}

bool gfam::CommonEditUIFactory::CanCut(const gcmp::UniIdentity & uid) const
{
    return true;
}

const std::map<gcmp::UniIdentity, ComponentGroupType>& gfam::CommonEditUIFactory::GetComponentGroupMap() const
{
    static std::map<gcmp::UniIdentity, ComponentGroupType> s_componentGroupMap =
    {
    };

    return s_componentGroupMap;
}

const std::wstring gfam::CommonEditUIFactory::GetDbClickCommandByCategory(const gcmp::UniIdentity & categoryUid) const
{
    const static std::map<gcmp::UniIdentity, std::wstring> s_mapCategoryToCmdName
    {
    };
    auto iter = s_mapCategoryToCmdName.find(categoryUid);
    return iter != s_mapCategoryToCmdName.end() ? iter->second : L"";
}

gcmp::OwnerPtr<OffsetPickFilter> gfam::CommonEditUIFactory::GetOffsetPickFilter(gcmp::IDocument * pDocument) const
{
    return nullptr;
}

const std::vector<std::wstring>& gfam::CommonEditUIFactory::GetSingleSelectedCmdNames() const
{
    static const std::vector<std::wstring> s_singleSelectedCmdNames =
    {
        ID_CMD_FILTER_SELECTION,
        ID_CMD_EDIT_FORM,
        ID_CMD_SETUP_NEW_RELATEDPLANE_ON_FACE,
        ID_CMD_SETUP_NEW_RELATEDPLANE_ON_WORKPLANE,
        ID_CMD_REMOVE_RELATEDPLANE
    };

    return s_singleSelectedCmdNames;
}

const std::vector<std::wstring>& gfam::CommonEditUIFactory::GetMultiSelectedCmdNames() const
{
    static const std::vector<std::wstring> s_multiSelectedCmdNames =
    {
        ID_CMD_FILTER_SELECTION,
        ID_CMD_EDIT_FORM,
        ID_CMD_SETUP_NEW_RELATEDPLANE_ON_FACE,
        ID_CMD_SETUP_NEW_RELATEDPLANE_ON_WORKPLANE,
        ID_CMD_REMOVE_RELATEDPLANE
    };

    return s_multiSelectedCmdNames;
}

CommonEditUIFactory m_commonEditUIFactory;